//
// Created by root on 5/30/17.
//

#ifndef FUNNY_SCHEME_FRACTION_H
#define FUNNY_SCHEME_FRACTION_H

#include "../ds/datastructure.h"

DEFINE_OPERATOR( make_fraction  );
DEFINE_OPERATOR( numerator      );
DEFINE_OPERATOR( denominator    );
INIT_OPERATORS( fraction );

long gcd(long a, long b);
Cell* fraction_reduction(Scheme *sc, Cell* f);
int is_zero_fraction(Cell *x);
Cell* make_fraction(Scheme *sc, Cell* a, Cell* b);
Cell* fraction_add(Scheme *sc, Cell* x, Cell* y);
Cell* fraction_mul(Scheme *sc, Cell* x, Cell* y);
Cell* fraction_sub(Scheme *sc, Cell* x, Cell* y);
Cell* fraction_div(Scheme *sc, Cell* x, Cell* y);
Cell* fraction_to_decimal(Scheme *sc, Cell* x);

#endif //FUNNY_SCHEME_FRACTION_H
